﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace com.sharepointutils.application
{
    public class QueryFieldRef
    {
        public String Field { get; set; }
        public Boolean Ascending { get; set; }
        public Boolean LookupID { get; set; }

        public override string ToString()
        {
            String xml = "<FieldRef Name=\"" + this.Field + "\"";
            xml += !Ascending ? "Ascending=\"FALSE\"" : "";
            xml += LookupID ? "LookUpID=\"True\"" : "";
            xml += " />";
            return xml;
        }

        public QueryFieldRef(String fieldName)
        {
            this.Field = fieldName;
            this.Ascending = true;
            this.LookupID = false;
        }

        public QueryFieldRef(String fieldName, Boolean ascending, Boolean lookupID)
        {
            this.Field = fieldName;
            this.Ascending = ascending;
            this.LookupID = lookupID;
        }
    }
}
